package com.wuhao.springbootactivemq.topic;

import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.jms.annotation.JmsListener;
import org.springframework.jms.core.JmsMessagingTemplate;
import org.springframework.stereotype.Component;
import javax.jms.JMSException;
import javax.jms.TextMessage;

/**
 * @author: wuhao
 * @since: 2021/11/7 17:24
 */
@Component
@Slf4j
@AllArgsConstructor
public class TopicConsume {

    private final JmsMessagingTemplate jmsMessagingTemplate;

    @JmsListener(destination = "${topic.name}")
    public void consumeTopic(TextMessage message) throws JMSException {

        log.info("-------消费主题消息:{}", message.getText());
    }
}
